package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.PolygonBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class PolygonAdapter extends StkProviderMultiAdapter<PolygonBean> {
    public PolygonAdapter() {
        super(1);
        addItemProvider(new PolygonItemProvider());
    }

    private class PolygonItemProvider extends BaseItemProvider<PolygonBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_polygon;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, PolygonBean polygonBean) {
            baseViewHolder.setImageResource(R.id.ivPolygonIcon, polygonBean.getIcon());
            if (polygonBean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivPolygonSel, R.drawable.aweixzkk);
            } else {
                baseViewHolder.setImageResource(R.id.ivPolygonSel, R.drawable.aweixuankuang);
            }
        }
    }
}
